<?php

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Passport\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use App\Notifications\ResetPasswordNotification;

class Member extends Authenticatable
{
    use HasApiTokens;

    protected $table = 'members';
    protected $fillable = ['phone','name','password','avatar','remember_token','uuid'];
    protected $hidden = ['password','remember_token'];

    // 重置api认证字段，默认为email
    public function findForPassport($username)
    {
        return $this->where('phone', $username)->first();
        // 多字段认证
//        return $this->orWhere('email', $username)->orWhere('phone', $username)->first();
    }

}
